<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main" />
    <g:set var="entityName" value="${message(code: 'AccountContact.label', default: 'AccountContact')}" />
    <title>新增离职员工</title>
</head>

<body class="fixed-navbar fixed-sidebar">

    <div class="small-header">

        <div class="hpanel">
            <div class="panel-body">
                <div id="hbreadcrumb" class="pull-right m-t-lg">
                    <ol class="hbreadcrumb breadcrumb">
                        <li>Next CRM</li>
                        <li>权限管理</li>
                        <li class="active">
                            <span>新增员工</span>
                        </li>
                    </ol>
                </div>
                <h2 class="font-light m-b-xs">
                用户:${com.next.User.findById(params['id'])?.fullName}
            </h2>
            </div>
        </div>

    </div>

    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hgreen">
                <div class="panel-heading">
                    新增员工
                </div>

                <div class="panel-body">
                    <g:if test="${flash.message}">
                        <div class="message" role="status">${flash.message}</div>
                    </g:if>
                    <g:hasErrors bean="${this.accountContact}">
                        <ul class="errors" role="alert">
                            <g:eachError bean="${this.accountContact}" var="error">
                                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                                    <g:message error="${error}" />
                                </li>
                            </g:eachError>
                        </ul>
                    </g:hasErrors>
                    <g:form action="save" class="form-horizontal">
                        <div class="form-group row">
                            <label class="col-md-3 control-label">公司名称</label>

                            <div class="col-md-4">
                                <g:select class="form-control m-b" name="account.id" required="" id="account" noSelection="${['': '请选择']}" from="${com.next.Account.findAllByActive(true)}" optionKey="id" optionValue="name" value="${this.accountContact?.account?.id}">></g:select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-3 control-label">员工姓名</label>

                            <div class="col-md-4">
                                <g:select class="form-control m-b" name="contact.id" required="" id="contact" noSelection="${['': '请选择']}" from="${com.next.Contact.findAllByActive(true)}" optionKey="id" optionValue="fullName" value="${this.accountContact?.contact?.id}"></g:select>
                            </div>
                            <g:link action="create" controller="contact" class="btn btn-info  m-b" target="new"><i class="fa fa-plus"></i>新建联系人</g:link>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-3 control-label">雇用时间</label>

                            <div class="col-md-4 datePicker">
                                <g:datePicker class="form-control" name="hiredate" value="${this.accountContact?.hiredate}" precision="day" years="${1990..2050}" default="none" noSelection="['': '请选择']" />
                                <!-- <g:datePicker class="form-control" name="hiredate" value="${new Date()}" precision="day" years="${1990..2050}"/> -->
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group row">
                            <label class="col-md-3 control-label">离职时间</label>

                            <div class="col-md-4 datePicker">
                                <g:datePicker class="form-control" name="leavedate" value="${this.accountContact?.leavedate}" precision="day" years="${1990..2050}" default="none" noSelection="['': '请选择']" />
                                <!-- <g:datePicker class="form-control" name="leavedate" value="${new Date()}" precision="day" years="${1990..2050}"/> -->
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group row">
                            <div class="col-md-7">
                                <g:submitButton name="create" class="btn btn-info" value="保存" />
                            </div>
                        </div>
                    </g:form>
                </div>
            </div>
        </div>

    </div>

</body>

</html>